<?php

namespace App\Http\Controllers\Rent;

use App\Http\Controllers\ShopController;
use App\Models\Category as CategoryModel;
use App\Models\Product\Product as ProductModel;

class HomeController extends ShopController
{
    public function index()
    {
        $newList = ProductModel::where([['flag','=','1'],['rentstatus','<>','1']])->limit(6)->OrderBy('createtime','desc')->get();
        $recomList = ProductModel::where([['flag','=','3'],['rentstatus','<>','1']])->limit(6)->OrderBy('createtime','desc')->get();

        $cateList = CategoryModel::where('flag','LIKE','index')->OrderBy('createtime','desc')->limit(6)->get();

        $data = [
            'newList' => $newList,
            'recomList' => $recomList,
            'cateList' => $cateList
        ];

        return $this->success('查询成功',$data);
    }
}
